﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite;

namespace BlueMarble.Genesis.View
{
    /// <summary>
    /// Interaction logic for StartPageView.xaml
    /// </summary>
    public partial class MainView : UserControl, IMainView, IActiveAware
    {
        public MainView()
        {
            InitializeComponent();
        }

        #region IMainView Members

        public IMainViewModel ViewModel
        {
            get { return this.DataContext as IMainViewModel; }
            set
            {
                this.DataContext = value;
            }
        }

        #endregion

        #region IActiveAware Members

        private bool isActive;
        public bool IsActive
        {
            get
            {
                return isActive;
            }
            set
            {
                isActive = value;
                IActiveAware vmAware = DataContext as IActiveAware;
                if (vmAware != null)
                    vmAware.IsActive = value;
            }
        }
        public event EventHandler IsActiveChanged = delegate { };

        #endregion
    }
}
